package com.fs.common.util.page;

import com.baomidou.mybatisplus.core.toolkit.sql.SqlUtils;
import com.fs.common.core.page.PageDomain;
import com.fs.common.core.page.TableSupport;
import com.fs.common.util.sql.SqlUtil;
import com.github.pagehelper.PageHelper;

/**
 * 分页工具类
 */
public class PageUtils {
    /**
     * 设置请求分页数据
     */
    public static PageDomain startPage() {
        return  TableSupport.getPageDomain();
    }

    public static void ruoyistartPage()
    {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Integer pageNum = pageDomain.getPageNum();
        Integer pageSize = pageDomain.getPageSize();
        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
        Boolean reasonable = pageDomain.getReasonable();
        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
    }

}
